<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:replace="_fragments :: head(~{::title})">
    <title>博客后台登陆</title>
</head>
<body>
<div class="m-container-small m-padded-tb-massive" style="max-width: 30em !important;">
    <div class="ui container">
        <div class="ui middle aligned center aligned grid">
            <div class="column">
                <h2 class="ui m-pink image header">
                    <img th:src="@{/img/logo.jpg}" class="image" style="border-radius: 50%!important;">
                    <div class="content">
                        管理后台登录
                    </div>
                </h2>
                <form class="ui large form" method="post" th:action="@{/admin/login}">
                    <div class="ui  segment">
                        <div class="field">
                            <div class="ui left icon input">
                                <i class="user icon"></i>
                                <input type="text" name="username" placeholder="用户名">
                            </div>
                        </div>
                        <div class="field">
                            <div class="ui left icon input">
                                <i class="lock icon"></i>
                                <input type="password" name="password" placeholder="密码">
                            </div>
                        </div>
                        <button class="ui fluid large secondary m-bg-pink submit button">登 录</button>
                    </div>
                    <div class="ui right" style="padding-left: 351px">
                        <a th:href="@{/}" class="m-pink">返回主页</a>
                    </div>
                    <div class="ui error mini message"></div>
                    <div class="ui negative mini message" th:unless="${#strings.isEmpty(message)}" th:text="${message}"></div>
                </form>
            </div>
        </div>
    </div>
</div>
<!--/*/<th:block th:replace="_fragments :: script">/*/-->
<!--/*/</th:block>/*/-->
<!--适配移动端和电脑端-->
<!--樱花飘落-->
<script type="text/javascript">
    var browser = {
        versions: function () {
            var u = navigator.userAgent, app = navigator.appVersion;
            return {     //移动终端浏览器版本信息
                trident: u.indexOf('Trident') > -1, //IE内核
                presto: u.indexOf('Presto') > -1, //opera内核
                webKit: u.indexOf('AppleWebKit') > -1, //苹果、谷歌内核
                gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') == -1, //火狐内核
                mobile: !!u.match(/AppleWebKit.*Mobile.*/), //是否为移动终端
                ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端
                android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, //android终端或uc浏览器
                iPhone: u.indexOf('iPhone') > -1, //是否为iPhone或者QQHD浏览器
                iPad: u.indexOf('iPad') > -1, //是否iPad
                webApp: u.indexOf('Safari') == -1 //是否web应用程序，没有头部与底部
            };
        }(),
        language: (navigator.browserLanguage || navigator.language).toLowerCase()
    }
    if (browser.versions.mobile) {
        //执行移动端的相关代码
        //alert("移动端");
        //设置移动端不显示网易云音乐插件
        /*      onload = function () {
                  var MusicDivShow = document.getElementById('netEasy-music');//获取指定div中的元素
                  MusicDivShow.style.display = 'none';//控制层隐藏
              };*/
    } else if (!browser.versions.mobile) { //非移动端，动态加载js和div
        //设置电脑端显示网易云音乐插件
        // onload = function () {
        //     var MusicDivShow = document.getElementById('netEasy-music');//获取指定div中的元素
        //     MusicDivShow.style.display = 'block';//控制层显示
        // };
        // var script1 = document.createElement('script');
        // script1.type = 'text/javascript';
        // script1.src = '\\js\\snow.js';

        // <!-- 天气预报 -->
        // WIDGET = {FID: 'EtgqPWMbdv'}
        // var script4 = document.createElement('script');
        // script4.type = 'text/javascript';
        // script4.src = 'https://apip.weatherdt.com/float/static/js/r.js?v=1111';

        var script2 = document.createElement('script');
        script2.type = 'text/javascript';
        // script2.src = 'https://cdn.jsdelivr.net/gh/yremp/yremp-js@1.5/sakura.js';
        script2.src = 'https://yremp.live/wp-content/uploads/resource/js/sakura.js';

        //画图
        // var script3 = document.createElement('script');
        // script3.type = 'text/javascript';
        // script3.color = '220,220,220';
        // script3.opacity = '0.7';//透明度
        // script3.zIndex = '-2';
        // script3.count = '200';
        // script3.src = '//cdn.bootcss.com/canvas-nest.js/1.0.0/canvas-nest.min.js';

        // $('body').append(script1);
        // $('body').append(script4);天气预报
        $('body').append(script2);
        // $('body').append(script3);划线背景
    }
</script>
<script>
    $('.menu.toggle').click(function () {
        $('.m-item').toggleClass('m-mobile-hide');
    });
    /*非空验证*/
    $('.ui.form').form({
        fields: {
            username: {
                identifier: 'username',
                rules: [{
                    type: 'empty',
                    prompt: '请输入用户名'
                }]
            },
            password: {
                identifier: 'password',
                rules: [{
                    type: 'empty',
                    prompt: '请输入密码'
                }]
            }
        }
    });
    //消息提示关闭初始化
    $('.message .close')
        .on('click', function () {
            $(this)
                .closest('.message')
                .transition('fade');
        });
</script>
</body>
</html>
